#[doc = "Register `UART_ICR` writer"]
pub struct W(crate::W<UART_ICR_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<UART_ICR_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl core::convert::From<crate::W<UART_ICR_SPEC>> for W {
    fn from(writer: crate::W<UART_ICR_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Overflow error interrupt clear.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OEIC_AW {
    #[doc = "1: cleared."]
    CLEAR = 1,
}
impl From<OEIC_AW> for bool {
    #[inline(always)]
    fn from(variant: OEIC_AW) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `oeic` writer - Overflow error interrupt clear."]
pub struct OEIC_W<'a> {
    w: &'a mut W,
}
impl<'a> OEIC_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: OEIC_AW) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "cleared."]
    #[inline(always)]
    pub fn clear(self) -> &'a mut W {
        self.variant(OEIC_AW::CLEAR)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u16) & 0x01) << 10);
        self.w
    }
}
#[doc = "Break error interrupt clear.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BEIC_AW {
    #[doc = "1: cleared."]
    CLEAR = 1,
}
impl From<BEIC_AW> for bool {
    #[inline(always)]
    fn from(variant: BEIC_AW) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `beic` writer - Break error interrupt clear."]
pub struct BEIC_W<'a> {
    w: &'a mut W,
}
impl<'a> BEIC_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: BEIC_AW) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "cleared."]
    #[inline(always)]
    pub fn clear(self) -> &'a mut W {
        self.variant(BEIC_AW::CLEAR)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u16) & 0x01) << 9);
        self.w
    }
}
#[doc = "Parity interrupt clear.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PEIC_AW {
    #[doc = "1: cleared."]
    CLEAR = 1,
}
impl From<PEIC_AW> for bool {
    #[inline(always)]
    fn from(variant: PEIC_AW) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `peic` writer - Parity interrupt clear."]
pub struct PEIC_W<'a> {
    w: &'a mut W,
}
impl<'a> PEIC_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: PEIC_AW) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "cleared."]
    #[inline(always)]
    pub fn clear(self) -> &'a mut W {
        self.variant(PEIC_AW::CLEAR)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u16) & 0x01) << 8);
        self.w
    }
}
#[doc = "Error interrupt clear.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FEIC_AW {
    #[doc = "1: cleared."]
    CLEAR = 1,
}
impl From<FEIC_AW> for bool {
    #[inline(always)]
    fn from(variant: FEIC_AW) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `feic` writer - Error interrupt clear."]
pub struct FEIC_W<'a> {
    w: &'a mut W,
}
impl<'a> FEIC_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: FEIC_AW) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "cleared."]
    #[inline(always)]
    pub fn clear(self) -> &'a mut W {
        self.variant(FEIC_AW::CLEAR)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u16) & 0x01) << 7);
        self.w
    }
}
#[doc = "RX timeout interrupt clear.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RTIC_AW {
    #[doc = "1: cleared."]
    CLEAR = 1,
}
impl From<RTIC_AW> for bool {
    #[inline(always)]
    fn from(variant: RTIC_AW) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `rtic` writer - RX timeout interrupt clear."]
pub struct RTIC_W<'a> {
    w: &'a mut W,
}
impl<'a> RTIC_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RTIC_AW) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "cleared."]
    #[inline(always)]
    pub fn clear(self) -> &'a mut W {
        self.variant(RTIC_AW::CLEAR)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u16) & 0x01) << 6);
        self.w
    }
}
#[doc = "TX interrupt clear.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TXIC_AW {
    #[doc = "1: cleared."]
    CLEAR = 1,
}
impl From<TXIC_AW> for bool {
    #[inline(always)]
    fn from(variant: TXIC_AW) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `txic` writer - TX interrupt clear."]
pub struct TXIC_W<'a> {
    w: &'a mut W,
}
impl<'a> TXIC_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: TXIC_AW) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "cleared."]
    #[inline(always)]
    pub fn clear(self) -> &'a mut W {
        self.variant(TXIC_AW::CLEAR)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u16) & 0x01) << 5);
        self.w
    }
}
#[doc = "RX interrupt clear.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RXIC_AW {
    #[doc = "1: cleared."]
    CLEAR = 1,
}
impl From<RXIC_AW> for bool {
    #[inline(always)]
    fn from(variant: RXIC_AW) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `rxic` writer - RX interrupt clear."]
pub struct RXIC_W<'a> {
    w: &'a mut W,
}
impl<'a> RXIC_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RXIC_AW) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "cleared."]
    #[inline(always)]
    pub fn clear(self) -> &'a mut W {
        self.variant(RXIC_AW::CLEAR)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u16) & 0x01) << 4);
        self.w
    }
}
impl W {
    #[doc = "Bit 10 - Overflow error interrupt clear."]
    #[inline(always)]
    pub fn oeic(&mut self) -> OEIC_W {
        OEIC_W { w: self }
    }
    #[doc = "Bit 9 - Break error interrupt clear."]
    #[inline(always)]
    pub fn beic(&mut self) -> BEIC_W {
        BEIC_W { w: self }
    }
    #[doc = "Bit 8 - Parity interrupt clear."]
    #[inline(always)]
    pub fn peic(&mut self) -> PEIC_W {
        PEIC_W { w: self }
    }
    #[doc = "Bit 7 - Error interrupt clear."]
    #[inline(always)]
    pub fn feic(&mut self) -> FEIC_W {
        FEIC_W { w: self }
    }
    #[doc = "Bit 6 - RX timeout interrupt clear."]
    #[inline(always)]
    pub fn rtic(&mut self) -> RTIC_W {
        RTIC_W { w: self }
    }
    #[doc = "Bit 5 - TX interrupt clear."]
    #[inline(always)]
    pub fn txic(&mut self) -> TXIC_W {
        TXIC_W { w: self }
    }
    #[doc = "Bit 4 - RX interrupt clear."]
    #[inline(always)]
    pub fn rxic(&mut self) -> RXIC_W {
        RXIC_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "UART_ICR is the interrupt clear register.\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [uart_icr](index.html) module"]
pub struct UART_ICR_SPEC;
impl crate::RegisterSpec for UART_ICR_SPEC {
    type Ux = u16;
}
#[doc = "`write(|w| ..)` method takes [uart_icr::W](W) writer structure"]
impl crate::Writable for UART_ICR_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets UART_ICR to value 0"]
impl crate::Resettable for UART_ICR_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
